Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[Numpy] Add infra for performing constraint check #17272

Merged
merged 9 commits into from
Jan 13, 2020

Conversation

xidulu
Copy link
Contributor

@xidulu xidulu commented Jan 11, 2020

Description

#16868
To perform constraint check on a tensor, one only need to multiply npx.constraint_check(condition(tensor), msg) with the origin tensor. In such way, the constraint_check is forced to be evaluated.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@leezu
Copy link
Contributor

leezu commented Jan 11, 2020

Could you improve the documentation to clarify how to ensure that the constraint check is executed?

@xidulu
Copy link
Contributor Author

xidulu commented Jan 11, 2020

Could you improve the documentation to clarify how to ensure that the constraint check is executed?

@leezu
I add some brief explanation and a toy example to demonstrate how this OP work in the doc section.
https://github.com/apache/incubator-mxnet/pull/17272/files#diff-23804c433abe5a6ae5c3a113425d3df8R60


Unfortunately, I cannot provide further technical details regarding why this hack could work, cuz I don't have know much knowledge about the computation graph engine.
But according to my test cases, this implementation could now do what it is designed to do.
https://github.com/apache/incubator-mxnet/pull/17272/files#diff-ccbb8554206b519fd0d562d679aadfdcR3145

@xidulu xidulu requested a review from szha as a code owner January 12, 2020 09:02
Copy link
Contributor

@haojin2 haojin2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haojin2 haojin2 merged commit 28e053e into apache:master Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants